local ziyong = fk.CreateSkill{
  name = "est__ziyong",
  frequency = Skill.Compulsory,
}

local ziyongEffect = {
  anim_type = "special",
  can_trigger = function(self, event, target, player, data)
      if not player.dead and player:hasSkill(self) and target == player and player.phase == Player.Start then
          return true
      end
  end,

  on_use = function(self, event, target, player, data)
      local room = player.room
      local num = room:getTag("RoundCount")
      if not num then
          return 
      end
      room:changeMaxHp(player, 1)
      if not player.dead and player:hasSkill(self) and num > 0 then
          local cards = room:askForDiscard(player, num, num, true, self.name, true, nil, "ziyong-ask")
          if not player:hasSkill(self) then return end
          if #cards == 0 then 
              player:drawCards(num)
              room:handleAddLoseSkills(player, "-est__ziyong", nil)
              room:broadcastPlaySound("./packages/est_test/audio/dowell/kuangfeng1")
          else
              room:recover({
                  who = player,
                  num = 1,
                  recoverBy = player,
                  skillName = self.name
                })
          end
      end
  end,
}
ziyong:addEffect(fk.EventPhaseStart, ziyongEffect)
ziyong:addEffect("maxcards", {
  correct_func = function(self, player)
    return player:getMark("ziyong-maxcards")
  end,
})
Fk:loadTranslationTable{
  ["est__ziyong"] = "自拥",
  [":est__ziyong"] = "锁定技，准备阶段，你增加1点体力上限，然后选择一项：1.弃置X张牌并回复1点体力；2.摸X张牌并失去此技能。（X为游戏轮数）",
  ["ziyong-ask"] = "选择弃置等于游戏轮数张牌，点取消则选择失去此技能并摸游戏轮数张牌",
}
return ziyong